package org.ccay.log.sqltrace.impl; 

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.ccay.log.SqlTraceVO;

/**
 * SQL Trace 跟踪监视器
 * @author chaowangbang
 * @since 2013-03-27
 */ 
public final class SqlTraceStatusManager {
	private static final SqlTraceStatusManager instance = new SqlTraceStatusManager();
	/**
	 * 是否启用SqlTrace
	 */
	static boolean sqlTraceEnabled  = false; 
	
	/**
	 * 存储跟踪的用户信息
	 */
	private static Map<String, SqlTraceVO> sqlTraceVOMap = new ConcurrentHashMap<String, SqlTraceVO>();


	/**
	 * @return
	 */
	public static Map<String, SqlTraceVO> getSqlTraceVOMap() {
		return sqlTraceVOMap;
	}

	/**
	 * @param sqlTraceVOMap
	 */
	public static void setSqlTraceVOMap(Map<String, SqlTraceVO> sqlTraceVOMap) {
		SqlTraceStatusManager.sqlTraceVOMap = sqlTraceVOMap;
	}

	/**
	 * 避免实例
	 */
	private SqlTraceStatusManager(){
	}
	
	/** 
	 * 获取唯一实例
	 * @return
	 */
	public static SqlTraceStatusManager getInstance(){
		return instance;
	}

	/**
	 * @return the isSqlTraceEnabled
	 */
	public static boolean isSqlTraceEnabled() {
		return sqlTraceEnabled;
	}

	/**
	 * @param isSqlTraceEnabled the isSqlTraceEnabled to set
	 */
	public static void setSqlTraceEnabled(boolean sqlTraceEnabled) {
		SqlTraceStatusManager.sqlTraceEnabled = sqlTraceEnabled;
	}
 
}
